import logging
import redis


class Config(object):
    """配置信息"""

    # SQLAlchemy配置
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@127.0.0.1:3306/information'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # 设置秘钥
    SECRET_KEY = 'asTFeAXtNhXNii7kwWzNlH/W7G84rHYC8YEeAAo0eJo='

    # redis配置
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379

    # Session配置
    SESSION_TYPE = 'redis'
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True
    PERMANENT_SESSION_LIFETIME = 86400 * 7

    DEBUG = True


class DevelopementConfig(Config):
    """开发模式下的配置"""
    DEBUG = True
    LOG_LEVEL = logging.DEBUG


class ProductionConfig(Config):
    """生产模式下的配置"""
    DEBUG = False
    LOG_LEVEL = logging.WARNING
